<template>
  <a-form ref="formRef" :model="form1" :rules="rules" layout="vertical">
<!--    <a-collapse v-model:activeKey="activeKey">
      <a-collapse-panel key="1" header="This is panel header 1" class="customStyle">-->
    <a-row :gutter="20">
      <a-col :span="12">
        <div class="card-title">基本信息</div>
      </a-col>
      <a-col :span="24">
        <div class="card-page">适用的ICD-10编码与疾病名称：</div>
      </a-col>

      <a-col :span="span24.includes(disease.submitName)?24:12" v-for="disease in cm01List">
        <a-form-item v-if="disease.useType=='input'&&disease.parentName==null&&!disease.submitName.startsWith(props.form.diseaseCode) " :label="disease.title" :name="disease.submitName">
          <a-input  v-model:value="disease.defaltValue"  @change="changeinput($event,disease.submitName)" allow-clear  />
        </a-form-item>
        <a-form-item v-if="disease.useType=='input'&&disease.parentName!=null&&( (form1[disease.parentName]!=null && form1[disease.parentName].includes(disease.parentValue))||form1[disease.parentName] == disease.parentValue )" :label="disease.title" :name="disease.submitName">
          <a-input  v-model:value="disease.defaltValue"  @change="changeinput($event,disease.submitName)" allow-clear  />
        </a-form-item>
        <a-form-item v-if="disease.useType=='number'" :label="disease.title" :name="disease.submitName">
          <a-input-number  v-model:value="disease.defaltValue"  @change="numberInput($event,disease.submitName)"  allow-clear  style="width: 100%;"/>
        </a-form-item>

        <a-form-item v-if="disease.useType=='date'" :label="disease.title" :name="disease.submitName">
          <a-date-picker  v-model:value="disease.defaltValue"
                          :format="disease.rule"
                          :valueFormat="disease.rule"
                          @change="dateInput($event,disease.submitName)"
                          :show-time="disease.rule.length>10 "
                          style="width: 100%;"
          />
        </a-form-item>


        <a-form-item v-if="disease.useType=='radio'" :label="disease.title" :name="disease.submitName">
          <a-radio-group v-model:value="disease.defaltValue">
          <a-radio
              v-for="dict in disease.dictList"
              :key="dict.dictCode"
              :value="dict.dictCode"
              @change="changeinput($event,disease.submitName)"
          >
            {{ dict.dictName }}
          </a-radio>
          </a-radio-group>
        </a-form-item>
        <a-form-item v-if="disease.useType=='checkbox'" :label="disease.title" :name="disease.submitName">
          <a-checkbox-group v-model:value="disease.defaultValue"   @change="checkSave($event,disease.submitName)" >
            <a-checkbox :value="dict.dictCode" :name="disease.submitName"
                        v-for="dict in disease.dictList" :key="dict.dictCode">{{
                dict.dictName
              }}</a-checkbox>
          </a-checkbox-group>
        </a-form-item>
<!--        :placeholder="disease.title"-->
        <a-form-item v-if="disease.useType=='select'" :label="disease.title" :name="disease.submitName">
          <a-select
              v-model:value="disease.defaltValue"
              placeholder="请选择属性类型" allow-clear
              @change="changeSelect($event,disease.submitName)"

          >
            <a-select-option
                v-for="dict in disease.dictList"
                :key="dict.dictCode"
                :value="dict.dictCode"
            >
              {{ dict.dictName }}
            </a-select-option>
          </a-select>
        </a-form-item>
        <a-form-item v-if="disease.useType=='selects'" :label="disease.title" :name="disease.submitName">
          <a-select
              v-model:value="disease.defaultValue"
              placeholder="请选择属性类型" allow-clear
              mode="multiple"
              @change="changeSelect($event,disease.submitName)"
          >
            <a-select-option
                v-for="dict in disease.dictList"
                :key="dict.dictCode"
                :value="dict.dictCode"
            >
              {{ dict.dictName }}
            </a-select-option>
          </a-select>
        </a-form-item>
        
      </a-col>
      <a-col :span="24">
        <div class="card-page">相关日期时间信息：</div>
      </a-col>
      <a-col :span="12" v-for="disease in cm02List">
<!--        <a-form-item v-if="disease.submitName=='CM-0-2-3-1'" :label="disease.title" :name="disease.submitName">
          <a-checkbox-group v-model:value="disease.defaultValue"  @change="checkSave($event,disease.submitName)"  >
            <a-checkbox :value="dict.dictCode" :name="disease.submitName"
                        v-for="dict in disease.dictList" :key="dict.dictCode">{{
                dict.dictName
              }}</a-checkbox>
          </a-checkbox-group>
        </a-form-item>-->
        <a-form-item v-if="(disease.submitName=='CM-0-2-3-2' && (form1['CM-0-2-3-1']==null || !form1['CM-0-2-3-1'].includes('UTD'))
        || disease.submitName=='CM-0-2-2-2' && (form1['CM-0-2-2-1']==null || !form1['CM-0-2-2-1'].includes('UTD')))" :label="disease.title" :name="disease.submitName">
          <a-date-picker  v-model:value="disease.defaltValue"
                          @change="dateInput($event,disease.submitName)"
                          format="YYYY-MM-DD HH:mm"
                          valueFormat="YYYY-MM-DD HH:mm"
                          show-time
                          style="width: 100%;"
          />
        </a-form-item>
        <a-form-item v-if="disease.useType=='input' && (disease.parentName == null ||(disease.parentName != null))" :label="disease.title" :name="disease.submitName">
          <a-input  v-model:value="disease.defaltValue"  @change="changeinput($event,disease.submitName)" allow-clear  />
        </a-form-item>
        <a-form-item v-if="disease.useType=='number'" :label="disease.title" :name="disease.submitName">
          <a-input-number  v-model:value="disease.defaltValue"   @change="numberInput($event,disease.submitName)"  allow-clear  style="width: 100%;"/>
        </a-form-item>

        <a-form-item v-if="disease.useType=='date'&&disease.submitName!='CM-0-2-3-2'&&disease.submitName!='CM-0-2-2-2'&&( disease.parentName==null
        ||(disease.parentName!==null &&
        ( (disease.parentValue === 'ne' && form1[disease.parentName]!==null )||(disease.parentValue!=='ne' && form1[disease.parentName]===disease.parentValue)) ))" :label="disease.title" :name="disease.submitName">
          <a-date-picker  v-model:value="disease.defaltValue"
                          :format="disease.rule"
                          :valueFormat="disease.rule"
                          @change="dateInput($event,disease.submitName)"
                          :show-time="disease.rule.length>10 "
                          style="width: 100%;"
          />
        </a-form-item>


        <a-form-item v-if="disease.useType=='radio'" :label="disease.title" :name="disease.submitName">
          <a-radio-group v-model:value="disease.defaltValue">
            <a-radio
                v-for="dict in disease.dictList"
                :key="dict.dictCode"
                :value="dict.dictCode"
                @change="changeinput($event,disease.submitName)"
            >
              {{ dict.dictName }}
            </a-radio>
          </a-radio-group>
        </a-form-item>
        <a-form-item v-if="disease.useType=='checkbox'" :label="disease.title" :name="disease.submitName">
          <a-checkbox-group v-model:value="disease.defaultValue"  @change="checkSave($event,disease.submitName)"  >
            <a-checkbox :value="dict.dictCode" :name="disease.submitName"
                        v-for="dict in disease.dictList" :key="dict.dictCode">{{
                dict.dictName
              }}</a-checkbox>
          </a-checkbox-group>
        </a-form-item>
        <!--        :placeholder="disease.title"-->
        <a-form-item v-if="disease.useType=='select'" :label="disease.title" :name="disease.submitName">
          <a-select
              v-model:value="disease.defaltValue"
              placeholder="请选择属性类型" allow-clear
               @change="changeSelect($event,disease.submitName)"
          >
            <a-select-option
                v-for="dict in disease.dictList"
                :key="dict.dictCode"
                :value="dict.dictCode"
            >
              {{ dict.dictName }}
            </a-select-option>
          </a-select>
        </a-form-item>
        <a-form-item v-if="disease.useType=='selects'" :label="disease.title" :name="disease.submitName">
          <a-select
              v-model:value="disease.defaultValue"
              placeholder="请选择属性类型" allow-clear
              mode="multiple"
              @change="changeSelect($event,disease.submitName)"
          >
            <a-select-option
                v-for="dict in disease.dictList"
                :key="dict.dictCode"
                :value="dict.dictCode"
            >
              {{ dict.dictName }}
            </a-select-option>
          </a-select>
        </a-form-item>

        
      </a-col>
      <a-col :span="24">
        <div class="card-page">其他相关信息：</div>
      </a-col>
      <a-col :span="12" v-for="disease in cm03List">
        <a-form-item v-if="disease.useType=='input'&&(disease.parentName == null ||form1[disease.parentName]==disease.parentValue)" :label="disease.title" :name="disease.submitName">
          <a-input  v-model:value="disease.defaltValue"  @change="changeinput($event,disease.submitName)"
                    allow-clear  />
        </a-form-item>
        <a-form-item v-if="disease.useType=='number'&&(disease.parentName == null ||form1[disease.parentName]==disease.parentValue)" :label="disease.title" :name="disease.submitName">
          <a-input-number  v-model:value="disease.defaltValue" allow-clear  @change="numberInput($event,disease.submitName)"  />
        </a-form-item>
        <a-form-item v-if="disease.useType=='date'&&(disease.parentName == null ||form1[disease.parentName]==disease.parentValue)" :label="disease.title" :name="disease.submitName">
          <a-date-picker  v-model:value="disease.defaltValue" :value-format="disease.rule"
                          @change="dateInput($event,disease.submitName)"
                          style="width: 100%;"/>
        </a-form-item>

        <a-form-item v-if="disease.useType=='radio'&&(disease.parentName == null ||form1[disease.parentName]==disease.parentValue)" :label="disease.title" :name="disease.submitName">
          <a-radio-group v-model:value="disease.defaltValue">
            <a-radio
                v-for="dict in disease.dictList"
                :key="dict.dictCode"
                :value="dict.dictCode"
                @change="changeinput($event,disease.submitName)"
            >
              {{ dict.dictName }}
            </a-radio>
          </a-radio-group>
        </a-form-item>
        <a-form-item v-if="disease.useType=='checkbox'&&(disease.parentName == null ||form1[disease.parentName]==disease.parentValue)" :label="disease.title" :name="disease.submitName">
          <a-checkbox-group v-model:value="disease.defaultValue"  @change="checkSave($event,disease.submitName)"  >
            <a-checkbox :value="dict.dictCode" :name="disease.submitName"
                        v-for="dict in disease.dictList" :key="dict.dictCode">{{
                dict.dictName
              }}</a-checkbox>
          </a-checkbox-group>
        </a-form-item>
        <!--        :placeholder="disease.title"-->
        <a-form-item v-if="disease.useType=='select'&&(disease.parentName == null ||form1[disease.parentName]==disease.parentValue)" :label="disease.title" :name="disease.submitName">
          <a-select
              v-model:value="disease.defaltValue"
              placeholder="请选择属性类型" allow-clear
               @change="changeSelect($event,disease.submitName)"
          >
            <a-select-option
                v-for="dict in disease.dictList"
                :key="dict.dictCode"
                :value="dict.dictCode"

            >
              {{ dict.dictName }}
            </a-select-option>
          </a-select>
        </a-form-item>
        <a-form-item v-if="disease.useType=='selects'&&(disease.parentName == null ||form1[disease.parentName]==disease.parentValue)" :label="disease.title" :name="disease.submitName">
          <a-select
              v-model:value="disease.defaultValue"
              placeholder="请选择属性类型" allow-clear
              mode="multiple"
              @change="changeSelect($event,disease.submitName)"
          >
            <a-select-option
                v-for="dict in disease.dictList"
                :key="dict.dictCode"
                :value="dict.dictCode"
            >
              {{ dict.dictName }}
            </a-select-option>
          </a-select>
        </a-form-item>
        
      </a-col>
      <patient-cs-form v-if="form.diseaseCode=='CS'" v-model:form1="form1" v-model:diseaseList="diseaseList"></patient-cs-form>
      <patient-aecopd-form v-if="form.diseaseCode=='AECOPD'" v-model:diseaseCode="form.diseaseCode" v-model:form1="form1" v-model:diseaseList="diseaseList"></patient-aecopd-form>
      <patient-ich-form v-if="form.diseaseCode=='ICH'" v-model:diseaseCode="form.diseaseCode" v-model:form1="form1" v-model:diseaseList="diseaseList"></patient-ich-form>
      <patient-tia-form v-if="form.diseaseCode=='TIA'" v-model:diseaseCode="form.diseaseCode" v-model:form1="form1" v-model:diseaseList="diseaseList"></patient-tia-form>
        <patient-cap-form v-if="form.diseaseCode=='Cap'" v-model:diseaseCode="form.diseaseCode" v-model:form1="form1" v-model:diseaseList="diseaseList"></patient-cap-form>
      <patient-cap-adult-form v-if="form.diseaseCode=='Cap-Adult'" v-model:diseaseCode="form.diseaseCode" v-model:form1="form1" v-model:diseaseList="diseaseList"></patient-cap-adult-form>
      <patient-stk-form v-if="form.diseaseCode=='STK'" v-model:diseaseCode="form.diseaseCode" v-model:form1="form1" v-model:diseaseList="diseaseList"></patient-stk-form>

        <a-col :span="24" v-for="disease in cm7List">
        <a-form-item v-if="disease.useType=='checkbox'" :label="disease.title" :name="disease.submitName">
          <a-checkbox-group v-model:value="disease.defaultValue"   @change="checkSave($event,disease.submitName)" >
            <a-checkbox :value="dict.dictCode" :name="disease.submitName"
                        v-for="dict in disease.dictList" :key="dict.dictCode">{{
                dict.dictName
              }}</a-checkbox>
          </a-checkbox-group>
          
        </a-form-item>
      </a-col>
      <a-col v-if="!['AECOPD','Cap','Cap-Adult','TIA','STK'].includes(props.form.diseaseCode)" :span="24">
        <div class="card-title">{{props.form.diseaseCode}}-{{num+1}}手术切口愈合情况</div>
        <a-col :span="span24.includes(disease.submitName)?24:12" v-for="disease in cm3List">
          <a-form-item v-if="disease.useType=='select'"
                       :label="disease.title" :name="disease.submitName">
            <a-select
                v-model:value="disease.defaltValue"
                placeholder="请选择属性类型" allow-clear
                 @change="changeSelect($event,disease.submitName)"
            >
              <a-select-option
                  v-for="dict in disease.dictList"
                  :key="dict.dictCode"
                  :value="dict.dictCode"
              >
                {{ dict.dictName }}
              </a-select-option>
            </a-select>

          </a-form-item>

          <a-form-item v-if="disease.useType=='input'&&form1['CM-3-2']!=null&&form1['CM-3-2'].includes('d')" :label="disease.title" :name="disease.submitName">
            <a-input  v-model:value="disease.defaltValue"  @change="changeinput($event,disease.submitName)" allow-clear  />
          </a-form-item>
        </a-col>
      </a-col>

      <a-col :span="24">
        <div class="card-title">{{props.form.diseaseCode}}-{{num+1}}离院方式</div>
      </a-col>
      <a-col :span="24" v-for="disease in cm4List">
        <a-form-item v-if="disease.useType=='select'
        &&(disease.rootName=='root'||(form1['CM-4-3']!='e'&&(disease.parentName==null||form1[disease.parentName]==disease.parentValue)))"
                     :label="disease.title" :name="disease.submitName">
          <a-select
              v-model:value="disease.defaltValue"
              placeholder="请选择属性类型" allow-clear
               @change="changeSelect($event,disease.submitName)"
          >
            <a-select-option
                v-for="dict in disease.dictList"
                :key="dict.dictCode"
                :value="dict.dictCode"
            >
              {{ dict.dictName }}
            </a-select-option>
          </a-select>
          
        </a-form-item>
        <a-form-item v-if="disease.useType=='checkbox'&&form1['CM-4-3']!='e'&&(disease.parentName==null||form1[disease.parentName]==disease.parentValue)" :label="disease.title" :name="disease.submitName">
          <a-checkbox-group v-model:value="disease.defaultValue"  @change="checkSave($event,disease.submitName)"  >
            <a-checkbox :value="dict.dictCode" :name="disease.submitName"
                        v-for="dict in disease.dictList" :key="dict.dictCode">{{
                dict.dictName
              }}</a-checkbox>
          </a-checkbox-group>
          
        </a-form-item>

        <a-form-item v-if="disease.useType=='input'&&form1['CM-4-3']!='e'&&form1[disease.parentName]!=null&&form1[disease.parentName].includes(disease.parentValue)" :label="disease.title" :name="disease.submitName">
          <a-input  v-model:value="disease.defaltValue"  @change="changeinput($event,disease.submitName)" allow-clear  />
        </a-form-item>
        <a-form-item v-if="disease.useType=='radio'&&form1['CM-4-3']!='e'&&(disease.parentName == null ||form1[disease.parentName]==disease.parentValue)" :label="disease.title" :name="disease.submitName">
          <a-radio-group v-model:value="disease.defaltValue">
            <a-radio
                v-for="dict in disease.dictList"
                :key="dict.dictCode"
                :value="dict.dictCode"
                @change="changeRadio($event,disease.submitName)"
            >
              {{ dict.dictName }}
            </a-radio>
          </a-radio-group>
        </a-form-item>
        <a-form-item v-if="disease.useType=='number'&&form1['CM-4-3']!='e'&&(disease.parentName == null ||form1[disease.parentName]==disease.parentValue)" :label="disease.title" :name="disease.submitName">
          <a-input-number  v-model:value="disease.defaltValue"  @change="numberInput($event,disease.submitName)"  allow-clear  style="width: 100%;"/>
        </a-form-item>
      </a-col>
      <a-col v-if="form1['CM-4-3']!='e'" :span="24">
        <div class="card-title">{{props.form.diseaseCode}}-{{num+2}}患者对服务的体验与评价</div>
      </a-col>
      <a-col :span="24" v-for="disease in cm5List">
        <a-form-item v-if="(form1['CM-5-1']=='y'&&form1['CM-4-3']!='e'&&disease.useType=='radio')||(disease.submitName=='CM-5-1'&&form1['CM-4-3']!='e')" :label="disease.title" :name="disease.submitName">
          <a-radio-group v-model:value="disease.defaltValue" @change="changeRadioCm5($event,disease.submitName)">
            <a-radio
                v-for="dict in disease.dictList"
                :key="dict.dictCode"
                :value="dict.dictCode"
            >
              {{ dict.dictName }}
            </a-radio>
          </a-radio-group>
          
        </a-form-item>

      </a-col>

      <div class="card-title">{{props.form.diseaseCode}}-{{num+3}}住院费用</div>
      <a-col :span="12" v-for="disease in cm6List">
        <a-form-item v-if="disease.useType=='number'" :label="disease.title" :name="disease.submitName">
          <a-input-number  v-model:value="disease.defaltValue"  @change="numberInput($event,disease.submitName)" allow-clear style="width: 100%" />
        </a-form-item>
        
      </a-col>


</a-row>
<!--      </a-collapse-panel>
    </a-collapse>-->
</a-form>
</template>

<script setup name="PositionForm">

import {ref, reactive, onMounted, watch} from 'vue';
import {DiseaseConfigApi} from "@/views/disease/patient/api/DiseaseConfigApi";
import PatientCsForm from './patient-cs-form.vue';
import PatientCapAdultForm from './patient-cap-adult-form.vue';
import PatientCapForm from './patient-cap-form.vue';
import PatientIchForm from './patient-ich-form.vue';
import PatientTiaForm from './patient-tia-form.vue';
import PatientAecopdForm from './patient-aecopd-form.vue';
import PatientStkForm from './patient-stk-form.vue';
import {message} from "ant-design-vue";
const diseaseList = ref([]);
const cm01List = ref([]);
const cm02List = ref([]);
const cm03List = ref([]);
const cm5List = ref([]);
const cm6List = ref([]);
const cm3List = ref([]);
const cm4List = ref([]);
const cm7List = ref([]);
const cm5show=ref(false);
const span24= ref([
  "CM-3-2-1",
    "IDCard",
]);
const num = ref(9);
const formRef = ref();
const dictList = ref([]);

const rules = reactive({

});
const props = defineProps({
// 表单数据
form: Object
});
onMounted(async() => {
  console.log("333333333333333")
});
watch(

() => props.form,
() => {
  if(props.form.diseaseCode == 'CS'){
    num.value = 10
  }
  if(props.form.diseaseCode == 'ICH'){
    num.value = 9
  }
  if(props.form.diseaseCode == 'Cap-Adult'||props.form.diseaseCode == 'Cap'){
    num.value = 7
  }
  if(props.form.diseaseCode == 'TIA'||props.form.diseaseCode == 'AECOPD'){
    num.value = 8
  }
  if(props.form.diseaseCode == 'STK'){
    num.value = 11
  }
  DiseaseConfigApi.list({ diseaseCode:props.form.diseaseCode,inNo:props.form.inNo}).then(res => {
    diseaseList.value = res.data;
    for(let i = 0; i < diseaseList.value.length; i ++) {
      let name = diseaseList.value[i].submitName;
      let val = diseaseList.value[i].defaltValue;
      if(diseaseList.value[i].isNull == '是'){
        let type ='string'
        if(diseaseList.value[i].type=='字符串'){
          type ='string'
        }else if(diseaseList.value[i].type=='数组'){
          type ='array'

        }
        rules[name]= [{ required: true, message: '请输入'+diseaseList.value[i].title, type: type, trigger: 'blur' }]
        if(diseaseList.value[i].type=='数值'){
          type ='number'
          rules[name]= [{ required: true, message: '请输入'+diseaseList.value[i].title }]
        }
      }
      if(diseaseList.value[i].type=='数组'){
        if(diseaseList.value[i].useType == 'selects'){
          if(diseaseList.value[i].defaultValue == null){
            diseaseList.value[i].defaultValue = []
          }
        }
        val = diseaseList.value[i].defaultValue;
      }
      form1.value[name]=val
      props.form.data = form1
      if ( diseaseList.value[i].submitName.startsWith("CM-0-1")||diseaseList.value[i].submitName=='caseId'
          ||diseaseList.value[i].submitName=='IDCard'||  diseaseList.value[i].submitName.startsWith(props.form.diseaseCode+"-0-1")||diseaseList.value[i].diseaseGroup=='CM-0-1') {

        cm01List.value.push(diseaseList.value[i])
      }
      else if ( diseaseList.value[i].submitName.startsWith("CM-0-2")||diseaseList.value[i].submitName=='age' ||  diseaseList.value[i].submitName.startsWith(props.form.diseaseCode+"-0-2")) {
        cm02List.value.push(diseaseList.value[i])
      }
     else  if ( diseaseList.value[i].submitName.startsWith("CM-0-3")||diseaseList.value[i].diseaseGroup=='CM-0-3') {
        cm03List.value.push(diseaseList.value[i])
      }else  if ( diseaseList.value[i].submitName.startsWith("CM-5")) {
        cm5List.value.push(diseaseList.value[i])
      }else  if ( diseaseList.value[i].submitName.startsWith("CM-6")) {
        cm6List.value.push(diseaseList.value[i])
      }else  if ( diseaseList.value[i].submitName.startsWith("CM-7")||diseaseList.value[i].diseaseGroup=='CM-7') {
        cm7List.value.push(diseaseList.value[i])
      }else  if ( diseaseList.value[i].submitName.startsWith("CM-3")) {
        cm3List.value.push(diseaseList.value[i])
      }else  if ( diseaseList.value[i].submitName.startsWith("CM-4")||diseaseList.value[i].diseaseGroup=='CM-4') {
        cm4List.value.push(diseaseList.value[i])
      }
    }
    if(form1.value["CM-5-1"]=="y") {
      cm5show.value =true
    }
    console.log("11111111122222222")
    formRef.value.validate().then(async valid => {
          console.log("22222222222222")
    });
  });
}
);

const form1 = ref({});
const changeinput =  (el,data) => {
  form1.value[data] = el.target.value
  formRef.value.validate().then(async valid => {
  });
}
const numberInput =  (el,data) => {
  form1.value[data] = el
}
const changeRadio =  (el,data) => {
  props.form1[data] = el.target.value
  let cols = []
  for(let i = 0; i < props.diseaseList.length; i ++) {
    if(data == props.diseaseList[i].parentName && props.diseaseList[i].parentVale != el.target.value){
      props.diseaseList[i].defaltValue = null
      props.diseaseList[i].defaultValue = null
      props.form1[props.diseaseList[i].submitName] = null
      cols.push(props.diseaseList[i].submitName)
    }
    if(cols.includes(props.diseaseList[i].parentName)){
      props.diseaseList[i].defaltValue = null
      props.diseaseList[i].defaultValue = null
      props.form1[props.diseaseList[i].submitName] = null
      cols.push(props.diseaseList[i].submitName)
    }

  }
}
const dateInput =  (el,data) => {
  form1.value[data] = el
  if(props.form.diseaseCode == 'STK'){
     if(data =='CM-0-2-3-2'||data =='CM-0-2-2-2'){
       if(form1.value['CM-0-2-3-2']!=null&&form1.value['CM-0-2-2-2']!=null&&(form1.value['STK-2-1-1-1'].length!=1)){
         let endDate = new Date(form1.value['CM-0-2-3-2'])
         let startDate = new Date(form1.value['CM-0-2-2-2'])
         let diff = endDate.getTime() - startDate.getTime()
         let hours = Math.floor(diff / (3600 * 1000))
         let mins = Math.floor(diff / (60 * 1000))
         console.log("hours:"+hours)
         for(let i = 0; i < diseaseList.value.length; i ++) {
           let name = diseaseList.value[i].submitName;
           if(name == 'STK-2-1-1-2'){
             diseaseList.value[i].defaltValue = hours;
           }
           if(name == 'STK-2-1-2'){
            if(hours<3){
              diseaseList.value[i].defaltValue = 'a'
            }else  if(mins<270){
              diseaseList.value[i].defaltValue = 'b'
            }else  if(hours<6){
              diseaseList.value[i].defaltValue = 'c'
            }else  if(hours<24){
              diseaseList.value[i].defaltValue = 'd'
            }else{
              diseaseList.value[i].defaltValue = 'e'
            }
           }
         }
       }

     }
  }
  formRef.value.validate().then(async valid => {
  });
}
const changeRadioCm5 =  (el,data) => {

  form1.value[data] = el.target.value
  if(data == "CM-5-1"&& el.target.value=="y") {
    cm5show.value =true
  }
  if(data == "CM-5-1"&& el.target.value=="n") {
    cm5show.value =false
  }
}
const checkSave=  (el,data) => {
  form1.value[data] = el
  if (el.length > 1 && el.includes("UTD")) {
    for (let i = 0; i < diseaseList.value.length; i++) {
      if (diseaseList.value[i].submitName == data) {
        diseaseList.value[i].defaultValue = ["UTD"]
        form1.value[data] = ["UTD"]
      }
    }
    message.error("填报内容不符合规范，请重新填报");
  }
}

const changeSelect =  (value,data) => {
  if (typeof value === "undefined"){
    form1.value[data] = null
  }else{
    form1.value[data] = value
  }
  formRef.value.validate().then(async valid => {
  });
}
const delSelect =  (value,data) => {
  debugger
  form1.value[data] = value
  formRef.value.validate().then(async valid => {
  });
}




// 验证规则

</script>

<style scoped lang="less">
.card-title {
width: 100%;
border-left: 5px solid;
border-color: var(--primary-color);
color: var(--primary-color);
font-size: large;
font-weight: bold;
padding-left: 10px;
margin-bottom: 10px;
}
.card-page {
width: 100%;
font-weight: bold;
color: #092b00;
padding-left: 1px;
margin-bottom: 1px;
}
.line {
border-top: 1px solid var(--primary-color); /* 设置横线的样式，比如颜色和宽度 */
margin: 1px 0; /* 设置横线的上下外边距 */
padding-left: -100px!important;
}
.ant-form-item{
  border-bottom:1px solid var(--primary-color);
}
.customStyle {
  background: #f7f7f7;
  border-radius: 4px;
  margin-bottom: 24px;
  border: 0;overflow: hidden;
}
.ant-collapse-header {
  border-color: var(--primary-color);
  color: var(--primary-color) !important;
}
.a-collapse-header {
  color: #333; /* 修改为你想要的颜色 */
}

</style>
